package com.example.web;

import com.example.model.Seckill;
import com.example.service.SeckillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 胡成
 * @Version: 0.0.1V
 * @Date: 2019/2/2
 * @Description: 类描述
 **/
@RestController
public class CacheController {

    @Autowired
    private SeckillService seckillService;

    @GetMapping("get")
    public Seckill get(long seckillId){
        return seckillService.get(seckillId);
    }

    @PostMapping("updateSeckill")
    public Seckill updateSeckill(@RequestBody Seckill seckill){
        return seckillService.updateByPrimaryKeySelective(seckill);
    }

    @GetMapping("del")
    public String del(long seckillId){
        return seckillService.delete(seckillId);
    }
}
